/*******************************************************************************
 Copyright (c) 2010 Koninklijke Philips N.V.,
 All Rights Reserved.
 
 File name: queue.h
 Description: Header file for the QUEUE component
 Project: XXX
 Component name: QUEUE 
 $LastChangedDate:  $
 $Revision:  $
 $Author:  $
 Lighting GBU CFLi
 
 This source code and any compilation or derivative thereof is the
 proprietary information of Koninklijke Philips N.V.
 and is confidential in nature.
 Under no circumstances is this software to be combined with any Open Source
 Software in any way or placed under an Open Source License of any type without
 the express written permission of Koninklijke Philips N.V.
*******************************************************************************/

#ifndef __QUEUE_H__
#define __QUEUE_H__

#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* INCLUDE FILES
*******************************************************************************/
#include "typedefs.h"

/*******************************************************************************
* CONSTANTS
*******************************************************************************/


/*******************************************************************************
* MACROS
*******************************************************************************/
#define QUEUE_ADD_EVENT(event, parameter, modid)        \
        CRITICAL_SECTION_BEGIN();                       \
        queue_add_event(event, parameter, modid);       \
        CRITICAL_SECTION_END();


/*******************************************************************************
* TYPEDEFS
*******************************************************************************/
typedef struct 
{
    uint8   rd_index;
    uint8   wr_index;
    uint8   data_count;
} queue_manager_t;


typedef struct
{
    uint16  param;
    uint8   event;
    uint8   module_id;
} event_t;


/*******************************************************************************
* VARIABLES
*******************************************************************************/

/*******************************************************************************
* FUNCTIONS
*******************************************************************************/
void queue_init(void);
void queue_add_event(uint8 event, uint16 parameter, uint8 module_id);
uint8 queue_get_event(event_t * p_event);


#ifdef __cplusplus
}
#endif

#endif //__QUEUE_H__
/******************************************************************************/
